package com.onlinelibrary.activities;

import android.annotation.SuppressLint;
import android.app.Application;
import android.content.SharedPreferences;
import android.util.Log;

import com.onlinelibrary.R;
import com.onlinelibrary.bean.MeListBean;
import com.onlinelibrary.utils.Http;

import org.jetbrains.annotations.NotNull;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;

public class App extends Application {
    public static String position,floor;
    public static String url;
    public static SharedPreferences sp;
    public static boolean hasLogin=false;
    public static String commentName,commentTime,commentContent;
    public static boolean is_staff=false;

    @Override
    public void onCreate() {
        super.onCreate();
        sp=getSharedPreferences("data",MODE_PRIVATE);
    }
    public static void autoLoginCheck(Callback callback) {
        App.hasLogin=false;
        if (App.sp.getBoolean("autoLogin",false)){
            Http.get("user/verify/?email="+App.sp.getString("account","")+"&password="+App.sp.getString("password",""),callback);
        }
    }

    public static void getMsg(Callback callback) {
        Http.get("user/getUserMsg/?email="+ App.sp.getString("account",""), callback);
    }
}
